home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / surfsrc3.zip / WRITECFG.INC < prev    next >
Text File  |  1991-09-30  |  2KB  |  90 lines

  1. { WRITECFG: Write a new-format configuration (INI) file }
  2. procedure WRITECFG;
  3. var Out: text;
  4.     Mat: integer;
  5.     Lite: integer;
  6.     Notopen: boolean;        { flag file not open yet }
  7.     Ans: string[5];
  8.  
  9. begin
  10.   { Open the new file for processing }
  11.   assign (Out, Inifile);
  12.   Notopen := TRUE;
  13.   while (Notopen) do begin
  14.     {$I-}
  15.     rewrite (Out);
  16.     {$I+}
  17.     if (ioresult = 0) then
  18.       Notopen := FALSE
  19.     else begin
  20.       writeln ('Error writing file ', Inifile);
  21.       write ('Try again (Y/N)? ');
  22.       readln (Ans);
  23.       if (Ans = 'N') or (Ans = 'n') then
  24.         exit;
  25.     end; { if ioresult }
  26.   end; { while }
  27.  
  28.   writeln (Out, 'VERSION: 5');
  29.   writeln (Out, 'EYE: ', Xeye, ' ', Yeye, ' ', Zeye);
  30.   writeln (Out, 'FOCAL: ', Xfocal, ' ', Yfocal, ' ', Zfocal);
  31.   writeln (Out, 'MAGNIFY: ', Magnify);
  32.   write (Out, 'VIEWTYPE: ');
  33.   case Viewtype of
  34.     0:  writeln (Out, 'STD');
  35.     1:  writeln (Out, 'XY');
  36.     2:  writeln (Out, 'YZ');
  37.     3:  writeln (Out, 'XZ');
  38.   end;
  39.   if (not Interpolate) then
  40.     Epsilon := 0;
  41.   writeln (Out, 'GOURAUD: ', Epsilon);
  42.   write (Out, 'SHADOWING: ');
  43.   if (Shadowing) then
  44.     writeln (Out, 'ON')
  45.   else
  46.     writeln (Out, 'OFF');
  47.   write (Out, 'AXISSHOW: ');
  48.   if (Showaxes = 1) then
  49.     writeln (Out, 'ON')
  50.   else
  51.     writeln (Out, 'OFF');
  52.   writeln (Out, 'AXISLEN: ', Xaxislen, ' ', Yaxislen, ' ', Zaxislen);
  53.   writeln (Out, 'AXISCOLOR: ', Axiscolor);
  54.   { DITHER: No longer supported }
  55.   if (not Dorandom) then
  56.     Randshade := 0;
  57.   writeln (Out, 'RANDOM: ', Randshade);
  58.   write (Out, 'BORDERS: ');
  59.   if (ShowAllBorders = 1) then
  60.     writeln (Out, 'ON')
  61.   else
  62.     writeln (Out, 'OFF');
  63.   write (Out, 'SHOWTITLE: ');
  64.   if (ShowTitle) then
  65.     writeln (Out, 'ON')
  66.   else
  67.     writeln (Out, 'OFF');
  68.  
  69.   { Write out material data }
  70.   for Mat := 1 to Nmatl do begin
  71.     writeln (Out, 'MATL: ', Mat);
  72.     writeln (Out, 'MATCONST: ', R1[Mat], ' ', R2[Mat], ' ', R3[Mat]);
  73.     writeln (Out, 'MATCOLOR: ', Color[Mat]);
  74.     writeln (Out, 'MATAMBIENT: ', Ambient[Mat]);
  75.     writeln (Out, 'MATRGB: ', Redmax[Mat], ' ', Grnmax[Mat], ' ', Blumax[Mat]);
  76.   end;
  77.  
  78.   { Write out the light source data }
  79.   for Lite := 1 to Nlite do begin
  80.     writeln (Out, 'LIGHT: ', Lite);
  81.     writeln (Out, 'LTCOORD: ', Xlite[Lite], ' ', Ylite[Lite], ' ', Zlite[Lite]);
  82.     writeln (Out, 'LTINTENS: ', Intensity[Lite]);
  83.   end;
  84.  
  85.   close (Out);
  86.  
  87. end; { WRITECFG }
  88.  
  89.  
  90.